#!/usr/bin/env python
#coding=utf-8

import os
import  configparser
from log import logger



class RunModeConfig(object):
    def __init__(self, run_mode_conf):
        config = configparser.ConfigParser()

        # 从配置文件中读取运行模式
        config.read(run_mode_conf, encoding='utf-8')
        try:
            self.run_mode = config['RUNMODE']['runmode']
            self.project_mode = int(config['PROJECTS']['project_mode'])
            self.projects = config['PROJECTS']['projects']
            self.interface = config['INTERFACE']['project']
            self.result_name = config['RESULT']['result_name']
            
            self.case_id_list = eval(config['TESTCASES']['case_id_list'])
        except Exception as e:
            logger.error(e)
            exit()
            
    @property
    def get_run_mode(self):
        return  self.run_mode
    
    @property
    def get_project_mode(self):
        return self.project_mode
    
    @property
    def get_projects(self):
        return self.projects
    
    @property
    def get_testcase_id_list(self):
        return self.case_id_list
    
    @property
    def get_reslut_name(self):
        return self.result_name


config_path=os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir,"config","runmodeconfig.conf"))
RUNMODECONFIG = RunModeConfig(config_path)

if __name__=="__main__":
    print RUNMODECONFIG.result_name


